home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / cancelbt / mainform.frm < prev    next >
Text File  |  1995-09-06  |  2KB  |  69 lines

  1. VERSION 2.00
  2. Begin Form MainForm 
  3.    Caption         =   "Main Process Form"
  4.    ClientHeight    =   3720
  5.    ClientLeft      =   1980
  6.    ClientTop       =   1755
  7.    ClientWidth     =   5460
  8.    Height          =   4125
  9.    Left            =   1920
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   3720
  12.    ScaleWidth      =   5460
  13.    Top             =   1410
  14.    Width           =   5580
  15.    Begin TextBox Text1 
  16.       BorderStyle     =   0  'None
  17.       Height          =   315
  18.       Left            =   2220
  19.       TabIndex        =   2
  20.       Top             =   2760
  21.       Width           =   2055
  22.    End
  23.    Begin CommandButton Command1 
  24.       Caption         =   "Begin Long Process"
  25.       Height          =   675
  26.       Left            =   1560
  27.       TabIndex        =   0
  28.       Top             =   1560
  29.       Width           =   2295
  30.    End
  31.    Begin Label Label1 
  32.       Alignment       =   1  'Right Justify
  33.       Caption         =   "Status:"
  34.       Height          =   255
  35.       Left            =   1080
  36.       TabIndex        =   1
  37.       Top             =   2760
  38.       Width           =   1035
  39.    End
  40. End
  41.  
  42. Sub Command1_Click ()
  43.     Dim x%, Counter&
  44.  
  45.     Text1.Tag = ""
  46.     Text1.Text = "Running..."
  47.  
  48.     CanDialog.Show
  49.  
  50.     Counter = 0
  51.     Do While Counter < 15000 And Text1.Tag = ""
  52.         x% = DoEvents()
  53.         Counter = Counter + 1
  54.     Loop
  55.  
  56.     Unload CanDialog
  57.  
  58.     Beep
  59.     If Text1.Tag = "" Then
  60.         Text1.Text = "Completed."
  61.         MsgBox "Process Completed."
  62.     Else
  63.         Text1.Text = "Cancelled..."
  64.         MsgBox "Process Cancelled!"
  65.     End If
  66.  
  67. End Sub
  68.  
  69.